public class BinaryTree {
    public class TreeNode{
        public char val;
        public TreeNode left;
        public TreeNode right;
        //调用此构造方法用于传值
        public TreeNode(char val) {
            this.val = val;
        }
    }
    //穷举法创建一个二叉树
    public TreeNode createBinaryTree() {
        TreeNode A = new TreeNode('A');
        TreeNode B = new TreeNode('B');
        TreeNode C = new TreeNode('C');
        TreeNode D = new TreeNode('D');
        TreeNode E = new TreeNode('E');
        TreeNode F = new TreeNode('F');
        TreeNode G = new TreeNode('G');
        A.left = B;
        A.right = C;
        B.left = D;
        B.right = E;
        C.left = F;
        C.right = G;
        return A;
    }
    //前序遍历二叉树
    //方法内部传入二叉树
    public void preOrder(TreeNode root) {
        //先判断是否为空树,空树不需要遍历
        if(root == null) {
            return;
        }
        System.out.print(root.val+" ");
        preOrder(root.left);
        preOrder(root.right);
    }
    //中序遍历二叉树
    public void inOrder(TreeNode root) {
        //判断是否为空树
        if(root == null) {
            return;
        }
        inOrder(root.left);
        System.out.println(root.val);
        inOrder(root.right);
    }
  /*  给你一个二叉树的根节点 root ， 检查它是否轴对称。*/

}
